package com.extension.company.view.details;

import android.graphics.Rect;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * 作者：Administrator
 * 时间：on 2019/2/18 14:50
 * 功能：recycleview的间距
 */
public class RecyclerViewSpacesItemDecoration extends RecyclerView.ItemDecoration {
	private int space;

	public RecyclerViewSpacesItemDecoration(int space) {
		this.space = space;
	}

	@Override
	public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
//		super.getItemOffsets(outRect, view, parent, state);
		outRect.left = space;
		outRect.right = space;
		outRect.bottom = space;

//		if (parent.getChildPosition(view) == 0)
//			outRect.top = space;
	}
}
